# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=openobex
pkgver=1.7.2
pkgrel=5
pkgdesc='Implementation of the OBject EXchange (OBEX) protocol.'
url="http://dev.zuckschwerdt.org/openobex/"
arch=('x86_64' 'aarch64')
license=('GPL' 'LGPL')
depends=('libusb' 'bluez-libs')
makedepends=('cmake' 'libxslt' 'doxygen' 'java-environment')
options=('staticlibs' '!makeflags')
source=("http://downloads.sourceforge.net/openobex/openobex-$pkgver-Source.tar.gz")
sha512sums=('22f1b0d99e7186da9fa12b510ef9dbb6f7d76777d58b235ab2f627703d07b6f6b0488cdc9c6d8c0ab7bc86d6d19117c55fff9273fed02736c0210f9b1788bf4d')

prepare() {
  sed -i 's|MODE="660", GROUP="plugdev"|TAG+="uaccess"|' \
    "openobex-$pkgver-Source/udev/openobex.rules.in"
}

build() {
  mkdir -p build

  cd build

  cmake ../openobex-$pkgver-Source \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_SKIP_RPATH=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DCMAKE_INSTALL_SBINDIR=/usr/bin \
    -DCMAKE_INSTALL_UDEVRULESDIR=/usr/lib/udev/rules.d
  make all openobex-apps
}

package() {
  cd build

  make DESTDIR="$pkgdir" install

  cp ../openobex-$pkgver-Source/apps/lib/*.h "$pkgdir/usr/include/$pkgname/"

  install -m 644 apps/lib/libopenobex-apps-common.a \
    "$pkgdir/usr/lib/libopenobex-apps-common.a"
}

